<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: PersonasController</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">PersonasController</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/app/controllers/personas_controller_rb.html">
                app/controllers/personas_controller.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="ApplicationController.html">
                ApplicationController
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000086">alumnos</a>&nbsp;&nbsp;
      <a href="#M000090">create</a>&nbsp;&nbsp;
      <a href="#M000079">delTag</a>&nbsp;&nbsp;
      <a href="#M000093">destroy</a>&nbsp;&nbsp;
      <a href="#M000091">edit</a>&nbsp;&nbsp;
      <a href="#M000087">exalumnos</a>&nbsp;&nbsp;
      <a href="#M000081">index</a>&nbsp;&nbsp;
      <a href="#M000084">list</a>&nbsp;&nbsp;
      <a href="#M000082">mails</a>&nbsp;&nbsp;
      <a href="#M000089">new</a>&nbsp;&nbsp;
      <a href="#M000080">new_persona_visita</a>&nbsp;&nbsp;
      <a href="#M000077">nro_alumnos</a>&nbsp;&nbsp;
      <a href="#M000078">primer_visita</a>&nbsp;&nbsp;
      <a href="#M000085">prospects</a>&nbsp;&nbsp;
      <a href="#M000083">search</a>&nbsp;&nbsp;
      <a href="#M000088">show</a>&nbsp;&nbsp;
      <a href="#M000092">update</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000086" class="method-detail">
        <a name="M000086"></a>

        <div class="method-heading">
          <a href="#M000086" class="method-signature">
          <span class="method-name">alumnos</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000086-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000086-source">
<pre>
     <span class="ruby-comment cmt"># File app/controllers/personas_controller.rb, line 124</span>
124:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">alumnos</span>
125:     
126:     <span class="ruby-identifier">cond</span> = <span class="ruby-node">&quot;coeficiente_id=#{Coeficiente::ALUMNO}&quot;</span>    
127:     (<span class="ruby-identifier">cond</span> = <span class="ruby-node">&quot;#{cond} AND #{params[:cond]}&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:cond</span>]
128:     
129:     <span class="ruby-ivar">@persona_pages</span>, <span class="ruby-ivar">@personas</span> = <span class="ruby-identifier">paginate</span> <span class="ruby-identifier">:personas</span>, <span class="ruby-identifier">:per_page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">10</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">cond</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'nombres'</span>
130:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000090" class="method-detail">
        <a name="M000090"></a>

        <div class="method-heading">
          <a href="#M000090" class="method-signature">
          <span class="method-name">create</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000090-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000090-source">
<pre>
     <span class="ruby-comment cmt"># File app/controllers/personas_controller.rb, line 146</span>
146:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create</span>
147:     <span class="ruby-ivar">@persona</span> = <span class="ruby-constant">Persona</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:persona</span>])
148:     <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@persona</span>.<span class="ruby-identifier">save</span>
149:       <span class="ruby-identifier">flash</span>[<span class="ruby-identifier">:notice</span>] = <span class="ruby-value str">'Persona was successfully created.'</span>
150:       <span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'list'</span>
151:     <span class="ruby-keyword kw">else</span>
152:       <span class="ruby-identifier">render</span> <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'new'</span>
153:     <span class="ruby-keyword kw">end</span>
154:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000079" class="method-detail">
        <a name="M000079"></a>

        <div class="method-heading">
          <a href="#M000079" class="method-signature">
          <span class="method-name">delTag</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000079-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000079-source">
<pre>
    <span class="ruby-comment cmt"># File app/controllers/personas_controller.rb, line 17</span>
17:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delTag</span>
18:     <span class="ruby-constant">Persona</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:id</span>]).<span class="ruby-identifier">tags</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:tag</span>]).<span class="ruby-identifier">destroy</span>
19:     <span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">:action=</span><span class="ruby-operator">&gt;</span><span class="ruby-value str">'show'</span>, <span class="ruby-identifier">:id=</span><span class="ruby-operator">&gt;</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:id</span>]
20:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000093" class="method-detail">
        <a name="M000093"></a>

        <div class="method-heading">
          <a href="#M000093" class="method-signature">
          <span class="method-name">destroy</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000093-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000093-source">
<pre>
     <span class="ruby-comment cmt"># File app/controllers/personas_controller.rb, line 174</span>
174:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">destroy</span>
175:     <span class="ruby-constant">Persona</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:id</span>]).<span class="ruby-identifier">destroy</span>
176:     <span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'list'</span>
177:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000091" class="method-detail">
        <a name="M000091"></a>

        <div class="method-heading">
          <a href="#M000091" class="method-signature">
          <span class="method-name">edit</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000091-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000091-source">
<pre>
     <span class="ruby-comment cmt"># File app/controllers/personas_controller.rb, line 156</span>
156:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">edit</span>
157:     <span class="ruby-ivar">@persona</span> = <span class="ruby-constant">Persona</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:id</span>])
158:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000087" class="method-detail">
        <a name="M000087"></a>

        <div class="method-heading">
          <a href="#M000087" class="method-signature">
          <span class="method-name">exalumnos</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000087-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000087-source">
<pre>
     <span class="ruby-comment cmt"># File app/controllers/personas_controller.rb, line 132</span>
132:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exalumnos</span>
133:     <span class="ruby-identifier">cond</span> = <span class="ruby-node">&quot;coeficiente_id=#{Coeficiente::EXALUMNO}&quot;</span>
134:     (<span class="ruby-identifier">cond</span> = <span class="ruby-node">&quot;#{cond} AND #{params[:cond]}&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:cond</span>]
135:     <span class="ruby-ivar">@persona_pages</span>, <span class="ruby-ivar">@personas</span> = <span class="ruby-identifier">paginate</span> <span class="ruby-identifier">:personas</span>, <span class="ruby-identifier">:per_page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">10</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">cond</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'nombres'</span>
136:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000081" class="method-detail">
        <a name="M000081"></a>

        <div class="method-heading">
          <a href="#M000081" class="method-signature">
          <span class="method-name">index</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000081-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000081-source">
<pre>
    <span class="ruby-comment cmt"># File app/controllers/personas_controller.rb, line 46</span>
46:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">index</span>
47:     <span class="ruby-identifier">list</span>
48:     <span class="ruby-identifier">render</span> <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'list'</span>
49:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000084" class="method-detail">
        <a name="M000084"></a>

        <div class="method-heading">
          <a href="#M000084" class="method-signature">
          <span class="method-name">list</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000084-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000084-source">
<pre>
     <span class="ruby-comment cmt"># File app/controllers/personas_controller.rb, line 110</span>
110:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">list</span>
111:     <span class="ruby-comment cmt"># TODO opciones de orden    </span>
112:     <span class="ruby-identifier">cond</span> = <span class="ruby-value str">'1'</span>
113:     (<span class="ruby-identifier">cond</span> = <span class="ruby-node">&quot;#{cond} AND #{params[:cond]}&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:cond</span>]
114:     <span class="ruby-ivar">@persona_pages</span>, <span class="ruby-ivar">@personas</span> = <span class="ruby-identifier">paginate</span> <span class="ruby-identifier">:personas</span>, <span class="ruby-identifier">:per_page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">10</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'nombres'</span>, <span class="ruby-identifier">:conditions=</span><span class="ruby-operator">&gt;</span> <span class="ruby-identifier">cond</span>
115:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000082" class="method-detail">
        <a name="M000082"></a>

        <div class="method-heading">
          <a href="#M000082" class="method-signature">
          <span class="method-name">mails</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
listados de <a href="PersonasController.html#M000082">mails</a>
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000082-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000082-source">
<pre>
    <span class="ruby-comment cmt"># File app/controllers/personas_controller.rb, line 56</span>
56:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mails</span>
57: 
58:     <span class="ruby-ivar">@mails</span> =<span class="ruby-value str">''</span>
59:     <span class="ruby-identifier">cond</span> = <span class="ruby-value str">'mail &lt;&gt; &quot;&quot;'</span>
60:     
61:     <span class="ruby-comment cmt">#piden un tipo de personas en particular</span>
62:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:coef_es</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">then</span>
63:       <span class="ruby-identifier">cond</span> = [<span class="ruby-identifier">cond</span>,<span class="ruby-value str">' AND coeficiente_id='</span>,<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:coef_es</span>]].<span class="ruby-identifier">join</span>
64:     <span class="ruby-keyword kw">end</span>
65:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:coef_de</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">then</span>
66:       <span class="ruby-identifier">cond</span> = [<span class="ruby-identifier">cond</span>,<span class="ruby-value str">' AND coeficiente_id&gt;='</span>,<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:coef_de</span>]].<span class="ruby-identifier">join</span>
67:     <span class="ruby-keyword kw">end</span>
68:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:coef_a</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">then</span>
69:       <span class="ruby-identifier">cond</span> = [<span class="ruby-identifier">cond</span>,<span class="ruby-value str">' AND coeficiente_id&lt;='</span>,<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:coef_a</span>]].<span class="ruby-identifier">join</span>
70:     <span class="ruby-keyword kw">end</span>
71:     
72:     <span class="ruby-identifier">personas</span> = <span class="ruby-constant">Persona</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:all</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">cond</span>)
73: 
74:     <span class="ruby-keyword kw">for</span> <span class="ruby-identifier">persona</span> <span class="ruby-keyword kw">in</span> <span class="ruby-identifier">personas</span>
75:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@mails</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">''</span> <span class="ruby-keyword kw">then</span>
76:         <span class="ruby-ivar">@mails</span> = [<span class="ruby-ivar">@mails</span>,<span class="ruby-identifier">persona</span>.<span class="ruby-identifier">mail</span>].<span class="ruby-identifier">join</span>(<span class="ruby-value str">';'</span>)
77:       <span class="ruby-keyword kw">else</span>
78:         <span class="ruby-ivar">@mails</span> = <span class="ruby-identifier">persona</span>.<span class="ruby-identifier">mail</span>
79:       <span class="ruby-keyword kw">end</span>
80:     <span class="ruby-keyword kw">end</span>
81:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000089" class="method-detail">
        <a name="M000089"></a>

        <div class="method-heading">
          <a href="#M000089" class="method-signature">
          <span class="method-name">new</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000089-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000089-source">
<pre>
     <span class="ruby-comment cmt"># File app/controllers/personas_controller.rb, line 142</span>
142:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new</span>
143:     <span class="ruby-ivar">@persona</span> = <span class="ruby-constant">Persona</span>.<span class="ruby-identifier">new</span>
144:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000080" class="method-detail">
        <a name="M000080"></a>

        <div class="method-heading">
          <a href="#M000080" class="method-signature">
          <span class="method-name">new_persona_visita</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
creacion de una persona y su primer visita analogo a <a
href="PersonasController.html#M000090">create</a>
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000080-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000080-source">
<pre>
    <span class="ruby-comment cmt"># File app/controllers/personas_controller.rb, line 24</span>
24:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new_persona_visita</span>
25:     <span class="ruby-ivar">@persona</span> = <span class="ruby-constant">Persona</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:persona</span>])
26:     <span class="ruby-ivar">@comosupos</span> = <span class="ruby-constant">Comosupo</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:all</span>, <span class="ruby-identifier">:order=</span><span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;nombre&quot;</span>)
27: 
28:     <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@persona</span>.<span class="ruby-identifier">save</span>
29:       
30:       <span class="ruby-comment cmt"># TODO que tambien tome , y ; como separador</span>
31:       <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:tags</span>].<span class="ruby-identifier">each</span>(<span class="ruby-value str">' '</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@persona</span>.<span class="ruby-identifier">tags</span>.<span class="ruby-identifier">create</span>(<span class="ruby-identifier">:tag=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">s</span>.<span class="ruby-identifier">strip</span>)}
32:       
33:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@persona</span>.<span class="ruby-identifier">visitas</span>.<span class="ruby-identifier">create</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:visita</span>])
34:         <span class="ruby-identifier">flash</span>[<span class="ruby-identifier">:notice</span>] = <span class="ruby-value str">'Visita registrada.'</span>
35:         <span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'list'</span>
36:       <span class="ruby-keyword kw">else</span>
37:         <span class="ruby-comment cmt">#la persona se creo pero fallo la visita. elimino la persona</span>
38:         <span class="ruby-ivar">@persona</span>.<span class="ruby-identifier">destroy</span>
39:         <span class="ruby-identifier">render</span> <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'primer_visita'</span>
40:       <span class="ruby-keyword kw">end</span>
41:     <span class="ruby-keyword kw">else</span>
42:       <span class="ruby-identifier">render</span> <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'primer_visita'</span>
43:     <span class="ruby-keyword kw">end</span>
44:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000077" class="method-detail">
        <a name="M000077"></a>

        <div class="method-heading">
          <a href="#M000077" class="method-signature">
          <span class="method-name">nro_alumnos</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <pre>
 FIXME no me lo toma
</pre>
<p>
devuelve la cantidad de <a
href="PersonasController.html#M000086">alumnos</a>
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000077-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000077-source">
<pre>
   <span class="ruby-comment cmt"># File app/controllers/personas_controller.rb, line 5</span>
5:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nro_alumnos</span>
6:     <span class="ruby-constant">Persona</span>.<span class="ruby-identifier">count</span>(<span class="ruby-node">&quot;coeficiente_id=#{Coeficiente::ALUMNO}&quot;</span>) 
7:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000078" class="method-detail">
        <a name="M000078"></a>

        <div class="method-heading">
          <a href="#M000078" class="method-signature">
          <span class="method-name">primer_visita</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
formulario de creacion de una persona y su primer visita de forma
simultanea.. analogo a <a href="PersonasController.html#M000089">new</a>
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000078-source">
<pre>
    <span class="ruby-comment cmt"># File app/controllers/personas_controller.rb, line 11</span>
11:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">primer_visita</span>
12:     <span class="ruby-ivar">@persona</span> = <span class="ruby-constant">Persona</span>.<span class="ruby-identifier">new</span>
13:     <span class="ruby-ivar">@visita</span> = <span class="ruby-constant">Visita</span>.<span class="ruby-identifier">new</span>
14:     <span class="ruby-ivar">@comosupos</span> = <span class="ruby-constant">Comosupo</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:all</span>, <span class="ruby-identifier">:order=</span><span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;nombre&quot;</span>)
15:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000085" class="method-detail">
        <a name="M000085"></a>

        <div class="method-heading">
          <a href="#M000085" class="method-signature">
          <span class="method-name">prospects</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000085-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000085-source">
<pre>
     <span class="ruby-comment cmt"># File app/controllers/personas_controller.rb, line 117</span>
117:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">prospects</span>
118:     <span class="ruby-comment cmt"># lista de los visitantes PERFIL que no se matricularon todavia</span>
119:     <span class="ruby-identifier">cond</span> = <span class="ruby-node">&quot;coeficiente_id&lt;#{Coeficiente::ALUMNO} AND coeficiente_id&gt;#{Coeficiente::FP}&quot;</span>
120:     (<span class="ruby-identifier">cond</span> = <span class="ruby-node">&quot;#{cond} AND #{params[:cond]}&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:cond</span>]
121:     <span class="ruby-ivar">@persona_pages</span>, <span class="ruby-ivar">@personas</span> = <span class="ruby-identifier">paginate</span> <span class="ruby-identifier">:personas</span>, <span class="ruby-identifier">:per_page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">10</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">cond</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'nombres'</span>
122:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000083" class="method-detail">
        <a name="M000083"></a>

        <div class="method-heading">
          <a href="#M000083" class="method-signature">
          <span class="method-name">search</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
devuelve listade de resultado de una busqueda
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000083-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000083-source">
<pre>
     <span class="ruby-comment cmt"># File app/controllers/personas_controller.rb, line 84</span>
 84:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">search</span>
 85: 
 86:     <span class="ruby-comment cmt"># TODO redirect_to :back te manda de vuelta por donde viniste!!!</span>
 87: 
 88:     <span class="ruby-identifier">search_in</span> = <span class="ruby-value str">'list'</span>
 89: 
 90:     <span class="ruby-comment cmt"># con search_in me indican si estoy buscando alumnos, exalumnos, etc</span>
 91:     <span class="ruby-identifier">par</span> = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:persona</span>]
 92:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">par</span>[<span class="ruby-identifier">:search_in</span>] <span class="ruby-keyword kw">then</span>
 93:       <span class="ruby-identifier">search_in</span> = <span class="ruby-identifier">par</span>[<span class="ruby-identifier">:search_in</span>]
 94:     <span class="ruby-keyword kw">end</span>
 95:     <span class="ruby-identifier">cond</span> = <span class="ruby-value str">'1'</span>
 96: 
 97:     <span class="ruby-comment cmt">#armo el filtro de busqueda con todos los atributos</span>
 98:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">par</span>[<span class="ruby-identifier">:nombres</span>] <span class="ruby-operator">!=</span> <span class="ruby-value str">''</span> <span class="ruby-keyword kw">then</span>
 99:       <span class="ruby-identifier">cond</span> = <span class="ruby-node">&quot;#{cond} AND nombres like '#{par[:nombres]}%'&quot;</span>
100:     <span class="ruby-keyword kw">end</span>
101:     
102:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">par</span>[<span class="ruby-identifier">:apellidos</span>] <span class="ruby-operator">!=</span> <span class="ruby-value str">''</span> <span class="ruby-keyword kw">then</span>
103:       <span class="ruby-identifier">cond</span> = <span class="ruby-node">&quot;#{cond} AND apellidos like '#{par[:apellidos]}%'&quot;</span>
104:     <span class="ruby-keyword kw">end</span>
105: 
106:      <span class="ruby-comment cmt"># efectuo la busqueda en el otro control</span>
107:      <span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">:action=</span><span class="ruby-operator">&gt;</span> <span class="ruby-identifier">search_in</span>, <span class="ruby-identifier">:cond</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">cond</span>
108:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000088" class="method-detail">
        <a name="M000088"></a>

        <div class="method-heading">
          <a href="#M000088" class="method-signature">
          <span class="method-name">show</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000088-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000088-source">
<pre>
     <span class="ruby-comment cmt"># File app/controllers/personas_controller.rb, line 138</span>
138:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">show</span>
139:     <span class="ruby-ivar">@persona</span> = <span class="ruby-constant">Persona</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:id</span>])
140:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000092" class="method-detail">
        <a name="M000092"></a>

        <div class="method-heading">
          <a href="#M000092" class="method-signature">
          <span class="method-name">update</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000092-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000092-source">
<pre>
     <span class="ruby-comment cmt"># File app/controllers/personas_controller.rb, line 160</span>
160:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span>
161:     <span class="ruby-ivar">@persona</span> = <span class="ruby-constant">Persona</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:id</span>])
162:     <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@persona</span>.<span class="ruby-identifier">update_attributes</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:persona</span>])
163: 
164:       <span class="ruby-comment cmt"># TODO que tambien tome , y ; como separador</span>
165:       (<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:tags</span>].<span class="ruby-identifier">each</span>(<span class="ruby-value str">' '</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@persona</span>.<span class="ruby-identifier">tags</span>.<span class="ruby-identifier">create</span>(<span class="ruby-identifier">:tag=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">s</span>.<span class="ruby-identifier">strip</span>)}) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:tags</span>]
166: 
167:       <span class="ruby-identifier">flash</span>[<span class="ruby-identifier">:notice</span>] = <span class="ruby-value str">'Persona was successfully updated.'</span>
168:       <span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'show'</span>, <span class="ruby-identifier">:id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@persona</span>
169:     <span class="ruby-keyword kw">else</span>
170:       <span class="ruby-identifier">render</span> <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'edit'</span>
171:     <span class="ruby-keyword kw">end</span>
172:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>